forum

home / developersection / forums / wpf overrided datagrid how to set datagridcell selected style

WPF overrided datagrid how to set DatagridCell Selected style

E E Cummings 5931 19-Jul-2013

I have overrides DataGrid. Below are my code and XAML. How can I set style to change the DataGridCell background colour when the cell is selected?

<vw:DataGridExt

   Grid.Row="1"

   AlternatingRowBackground="LightGray"

   ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Value,Mode=OneWay, IsAsync=True}"

   Background="White"

   AutoGenerateColumns="True"

   IsReadOnly="True"

   CanUserResizeRows="False"

   ClipboardCopyMode="IncludeHeader"

   CanUserSortColumns="True"

   CanUserAddRows="False"

   SelectionMode="Extended"/>                

 public class DataGridExt : DataGrid

 {

     public DataGridExt()

     {

         this.AutoGeneratedColumns += new EventHandler(DataGrid_AutoGeneratedColumns);

     }

 }

thanks in advance


wpf wpf 
Updated on 19-Jul-2013
E E Cummings

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By